package com.patterns.builder.carModel.director;

import com.patterns.builder.carModel.Product.BMWModel;
import com.patterns.builder.carModel.Product.BenzModel;
import com.patterns.builder.carModel.builder.BMWBuilder;
import com.patterns.builder.carModel.builder.BenzBuilder;

import java.util.ArrayList;

/**
 * Created by Xiao Yiyun on 2017/4/21.
 */
public class Director {

    private ArrayList<String> arrayList = new ArrayList<String>();
    private BenzBuilder benzBuilder = new BenzBuilder();
    private BMWBuilder bmwBuilder = new BMWBuilder();

    public BenzModel getBenzModel1() {
        //注意！在使用前一定要清理场景
        this.arrayList.clear();
        this.arrayList.add("start");
        this.arrayList.add("stop");
        //按照顺序返回一个奔驰车
        this.benzBuilder.setArrayList(arrayList);
        return (BenzModel)this.benzBuilder.getCarModel();
    }

    public BMWModel getBMWModel1() {
        this.arrayList.clear();
        this.arrayList.add("start");
        this.arrayList.add("alarm");
        this.arrayList.add("engine");
        this.arrayList.add("stop");
        this.bmwBuilder.setArrayList(arrayList);
        return (BMWModel)this.bmwBuilder.getCarModel();
    }
}